package com.ljy.my_study.spring.循环依赖;

import com.ljy.my_study.spring.循环依赖.bean.A;
import com.ljy.my_study.spring.循环依赖.bean.B;
import com.ljy.my_study.spring.循环依赖.bean.C;
import com.ljy.my_study.spring.循环依赖.core.IBeanFactory;
import com.ljy.my_study.spring.循环依赖.core.MyBeanFactory;

import java.io.File;

public class TestMain {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        IBeanFactory beanFactory= new MyBeanFactory();
        beanFactory.scan("com.ljy.my_study.spring.循环依赖.bean");
        A a=beanFactory.getBean(A.class);
        B b=beanFactory.getBean(B.class);
        C c=beanFactory.getBean(C.class);
        a.setName("I am a.");
        b.setName("I am b.");
        c.setName("I am c.");
        System.out.println(a.getB().getName());
        System.out.println(b.getC().getName());
        System.out.println(c.getA().getName());
    }
}
